//
//  GDTSplashAdSkipView.m
//  SEGUhomeChassis
//
//  Created by 乔杨 on 2020/8/3.
//  Copyright © 2020 山刘. All rights reserved.
//

#import "GDTSplashAdSkipView.h"

@interface GDTSplashAdSkipView ()

/// 跳过Lab
@property (nonatomic, strong) UILabel *skipLab;

@end

@implementation GDTSplashAdSkipView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (!self) return nil;
    [self addSubview:self.skipLab];
    return self;
}

#pragma mark - UITraitEnvironment
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
    [super traitCollectionDidChange:previousTraitCollection];
    self.skipLab.layer.borderColor = kColor_C.CGColor;
}

#pragma mark - Setter
- (void)setCountDown:(NSInteger)countDown {
    if (_countDown != countDown) {
        _countDown = countDown;
        self.skipLab.text = [NSString stringWithFormat:@"跳过 %ld", _countDown];
    }
}
#pragma mark - Getter
- (UILabel *)skipLab {
    if (!_skipLab) {
        _skipLab = [[UILabel alloc] initWithFrame:self.bounds];
        _skipLab.text = @"跳过";
        _skipLab.backgroundColor = kColor_W;
        _skipLab.textColor = kColor_C;
        _skipLab.font = kFont_14;
        _skipLab.userInteractionEnabled = YES;
        _skipLab.textAlignment = NSTextAlignmentCenter;
        _skipLab.layer.cornerRadius = 31/2;
        _skipLab.layer.masksToBounds = YES;
        _skipLab.layer.borderWidth = 0.5f;
        _skipLab.layer.borderColor = kColor_C.CGColor;
    }
    return _skipLab;
}

@end
